<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Utf-8">
<title>Product</title>
<script src="../jquery-1.9.1.min.js" type="text/javascript"></script>
<script src="../jquery-ext.js" type="text/javascript"></script>
<script src="jquery.uploadify.min.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="uploadify.css">
<style type="text/css">
body {
	font: 13px Arial, Helvetica, Sans-serif;
}
</style>
</head>
<body>
	<h1>Product Create</h1>
	<form id="inputForm"  action="../product/add" method="post" class="form-horizontal">
		<fieldset>
			<legend><small>Add production</small></legend>
		Category	<select name='categoryId'>  
            <option value='1'>Computer</option>  
            <option value='2'>Network</option>  
        </select>  <br>
		productName<input type="text" name="productName" id="productName" value="Test"><br>
		price<input type="text" name="price" id="price" value="12.00"><br>
		keywords<input type="text" name="keywords" id="keywords" value="IT,Software,Book"><br>
		introduction<input type="text" name="introduction" id="introduction" value="Introduction"><br>
		<div id="queue"></div>
		<input id="file" name="file" type="file" multiple="true"><br>
		<input type="hidden" name="fileId" id="fileId">
</fieldset>
</form>
		<button id="addBtn">Submit</button>
	<script>
		 $("#addBtn").click(function(){
			
			 $.postJSON("../admin/product/add",$("#inputForm").serializeObject(),
					 function (result) {
	        	 alert("Add Product successful?"+result.status+","+result.msg) 
	        });
				
			}); 
	</script>
	<script type="text/javascript">
		$(function() {
			$('#file').uploadify({
				//'swf'      : 'uploadify.swf',
				'fileObjName':'file',
				'uploader' : '../file/upload',
				 'onUploadSuccess' : function(file, data, response) {
					 result=$.parseJSON(data);
			      //   alert('The file ' + file.name + ' was successfully uploaded with a response of ' + response + ':' + data);
					 $('#fileId').val(result.data)
			        }
			});
		});
	</script>
	
	<hr>
	<h1>Search</h1>
	<form id="inputForm"  action="product/search" method="GET" class="form-horizontal">
		Query<input type="text" name="q" id="q" value=""><br>
			Facet Query <input type="text" name="fq" id="fq" value=""><br>
			<input type="submit">
	</form>
</body>
</html>